package com.xingqing.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Data
@Component
@ConfigurationProperties(prefix = "file.storage")
public class FileStorageConfig {
    
    /**
     * 存储类型：local（本地磁盘）, oss（阿里云OSS）
     */
    private String type = "local";
    
    /**
     * 本地存储配置
     */
    private Local local = new Local();
    
    /**
     * 阿里云OSS配置
     */
    private Oss oss = new Oss();
    
    @Data
    public static class Local {
        /**
         * 本地上传目录
         */
        private String uploadDir = "./uploads";
        
        /**
         * 文件访问URL前缀
         */
        private String urlPrefix = "/uploads";
    }
    
    @Data
    public static class Oss {
        /**
         * 阿里云OSS endpoint
         */
        private String endpoint;
        
        /**
         * 阿里云OSS access key id
         */
        private String accessKeyId;
        
        /**
         * 阿里云OSS access key secret
         */
        private String accessKeySecret;
        
        /**
         * OSS bucket名称
         */
        private String bucketName;
        
        /**
         * OSS文件URL前缀
         */
        private String urlPrefix;
        
        /**
         * 文件路径前缀
         */
        private String pathPrefix = "tlias/";
    }
}